﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MVCPets.Extensions;

namespace MVCPets.Tests.Extensions
{
  [TestClass]
  public class IOExtensions
  {

    [TestMethod]
    public void Test_Create_To_File()
    {
      string path = Guid.NewGuid().ToString();
      "sometext".CreateToFile(path);
      Assert.IsTrue(path.GetFileText() != "");
    }

    [TestMethod]
    public void Test_Can_Replace_File_Text()
    {
      string path = Guid.NewGuid().ToString();
      "sometext".CreateToFile(path);
      Assert.IsTrue(path.GetFileText() == "sometext");

      path.UpdateFileText("sometext", "somethingelse");
      Assert.IsTrue(path.GetFileText() == "somethingelse");
    }

    [TestMethod]
    public void Test_Can_Get_HTML()
    {
      Assert.IsTrue("http://www.google.com".ReadWebPage() != "");
    }
  }
}
